class Solution {
public:
    vector<vector<string>> groupAnagrams(vector<string>& strs) {
        unordered_map<string, vector<string>> map;
        vector<vector<string>> ret;
        for(auto& e : strs)
        {
            string tmp = e;
            sort(tmp.begin(), tmp.end());
            map[tmp].push_back(e);
        }
        for(auto [a, b] : map)
        {
            ret.push_back(b);
        }
        return ret;
    }
};